package modele;

import java.sql.Date;

public class Session {
	private int idSession;
	private int idFormation;
	private Date dateDebut;
	private Date dateFin;
	private int nbMaxPlaces;
	private double tarif;
	private Date dateDebutInscription;
	private Date dateFinInscription;
	
	// Constructeur plein ----------------------------------------------------------------
	public Session(int idSession, int idFormation, Date dateDebut, Date dateDfin, int nbMaxPlaces, double tarif, Date dateDebutInscription, Date dateFinInscription) {
		this.idSession = idSession;
		this.idFormation = idFormation;
		this.dateDebut = dateDebut;
		this.dateFin = dateDfin;
		this.nbMaxPlaces = nbMaxPlaces;
		this.tarif = tarif;
		this.dateDebutInscription = dateDebutInscription;
		this.dateFinInscription = dateFinInscription;
	}
	// Constructeur vide -----------------------------------------------------------------
	public Session() {
		super();
		// TODO Auto-generated constructor stub
	}
		public String toString() {
		return" " +idSession+ " " +idFormation+ " Dates de la formation :  "+dateDebut+" au "+dateFin+" tarif : " +tarif+ " euro, nb max de place : " +nbMaxPlaces+ " Dates d'inscription : " +dateDebutInscription+ " au " +dateFinInscription+ " "  ;
	}
	public int getIdSession() {
		return idSession;
	}
	public void setIdSession(int idSession) {
		this.idSession = idSession;
	}
	public int getIdFormation() {
		return idFormation;
	}
	public void setIdFormation(int idFormation) {
		this.idFormation = idFormation;
	}
	public Date getDateDebut() {
		return dateDebut;
	}
	public void setDateDebut(Date dateDebut) {
		this.dateDebut = dateDebut;
	}
	public Date getDateFin() {
		return dateFin;
	}
	public void setDateFin(Date dateFin) {
		this.dateFin = dateFin;
	}
	public int getNbMaxPlaces() {
		return nbMaxPlaces;
	}
	public void setNbMaxPlaces(int nbMaxPlaces) {
		this.nbMaxPlaces = nbMaxPlaces;
	}
	public double getTarif() {
		return tarif;
	}
	public void setTarif(double tarif) {
		this.tarif = tarif;
	}
	public Date getDateDebutInscription() {
		return dateDebutInscription;
	}
	public void setDateDebutInscription(Date dateDebutInscription) {
		this.dateDebutInscription = dateDebutInscription;
	}
	public Date getDateFinInscription() {
		return dateFinInscription;
	}
	public void setDateFinInscription(Date dateFinInscription) {
		this.dateFinInscription = dateFinInscription;
	}

	
	// Source = Generate Equals()
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((dateDebut == null) ? 0 : dateDebut.hashCode());
		result = prime
				* result
				+ ((dateDebutInscription == null) ? 0 : dateDebutInscription
						.hashCode());
		result = prime * result + ((dateFin == null) ? 0 : dateFin.hashCode());
		result = prime
				* result
				+ ((dateFinInscription == null) ? 0 : dateFinInscription
						.hashCode());
		result = prime * result + idFormation;
		result = prime * result + idSession;
		result = prime * result + nbMaxPlaces;
		long temp;
		temp = Double.doubleToLongBits(tarif);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Session other = (Session) obj;
		if (dateDebut == null) {
			if (other.dateDebut != null)
				return false;
		} else if (!dateDebut.equals(other.dateDebut))
			return false;
		if (dateDebutInscription == null) {
			if (other.dateDebutInscription != null)
				return false;
		} else if (!dateDebutInscription.equals(other.dateDebutInscription))
			return false;
		if (dateFin == null) {
			if (other.dateFin != null)
				return false;
		} else if (!dateFin.equals(other.dateFin))
			return false;
		if (dateFinInscription == null) {
			if (other.dateFinInscription != null)
				return false;
		} else if (!dateFinInscription.equals(other.dateFinInscription))
			return false;
		if (idFormation != other.idFormation)
			return false;
		if (idSession != other.idSession)
			return false;
		if (nbMaxPlaces != other.nbMaxPlaces)
			return false;
		if (Double.doubleToLongBits(tarif) != Double
				.doubleToLongBits(other.tarif))
			return false;
		return true;
	}
}